import request from '@/utils/request'
import axios from 'axios'
// 取消请求接口  同一接口重复多次请求
let _cancelFn = ''
export function sysLogin (data) {
  try {
    _cancelFn()
  } catch {}

  return request({
    url: '/sys/login',
    method: 'post',
    cancelToken: new axios.CancelToken(cancelFn => {
      _cancelFn = cancelFn
    }),
    data
  })
}
// 获取用户信息
export function sysProfile () {
  return request({
    url: '/sys/profile',
    method: 'post'
  })
}
// 获取用户的其他信息 例如头像
export function sysUserById (id) {
  return request({
    url: `/sys/user/${id}`
  })
}
